package com.ioPackage;

import java.io.PrintStream;
import java.io.PrintWriter;

/**
 * @ClassName PrintDemo
 * @Description 打印流
 * @Author 2214361854
 * @Date 2022/3/1 17:08
 * @Version 1.0
 */
public class PrintDemo {
    public static void main(String[] args) throws Exception {
//        PrintStream ps = new PrintStream("src\\text03.txt");
//        ps.println(12);
//        ps.println("打印流字节，功能实用强大");
//        ps.close();

//        PrintWriter pw = new PrintWriter("src\\text03.txt");
//        pw.println(11);
//        pw.println("打印流字符，功能实用强大");
//        pw.close();


        String wz = "src\\text03.txt";
        PrintStream ps2 = new PrintStream(wz);
        System.out.println("重定向后位置："+wz);
        System.setOut(ps2);
        System.out.println("重定向了");
    }
}
